package com.googlecode.gwtbb.server.dao;

import com.googlecode.gwtbb.client.shared.entity.properties.GetId;

import java.util.Map;

/**
 * @author Abraham Grief
 * @version $Id$
 * @since May 4, 2008
 */
public interface Dao<T extends GetId> extends SelectDao<T> {
	/**
	 * This should create the instance in the database, auto-generating an id
	 * and setting the id on the instance if and only if the creation is successful.
	 *
	 * @param instance instance to create
	 */
	void create(T instance);

	void create(Iterable<T> instances);

	/**
	 * This should create the instance in the database, and the instance should already have its id set.
	 *
	 * @param instance instance to create
	 */
	void createPreIdentified(T instance);

	void createPreIdentified(Iterable<T> instances);

	void delete(T instance);

	Long generateId();

	int update(Map<String, Object> properties);

	int update(Iterable<Map<String, Object>> properator);
}
